//properties settings for text input
fmdmeta_prop.control.datepickeropt = {
		//group for element list - basic/composite/custom/extended
		"group" : "basic",
		//control category
		"controlcategory" : "datacontrol",
		//i18n type name
		"i18ntype" : fmd_i18n_el_datepickeropt,
		//icon in element list, located in images/designer/modules/
		"icon" : "elem_datepickeropt.png",
		//html code for dragging
		"innerhtml_dragging" : '<label class="title">'+fmd_i18n_untitled+'</label><input class="large" type="text" name="input"'+
			' value="&nbsp;&nbsp;&nbsp;&nbsp;2015-01-01" readonly="readonly" style="background-image:url('+resloc+'/static/images/form/designer/prop/datepicker.png);background-repeat:no-repeat"/>',
		//html code after dropped
		"innerhtml_dropped" : '<label class="title">'+fmd_i18n_untitled+'</label><input class="large" type="text" name="input"'+
			' value="&nbsp;&nbsp;&nbsp;&nbsp;2015-01-01" readonly="readonly" style="background-image:url('+resloc+'/static/images/form/designer/prop/datepicker.png);background-repeat:no-repeat"/>',
		//properties
		"includes-properties" : {
			"common" : fmdmeta_prop.common.all.properties,
			"controlcommon" : fmdmeta_prop.common.datacontrol.properties
		},
		"properties" : {
			"i18ntype" : {
		    	"name" : fmd_i18n_prop_selectiontype,
		    	"img" : "selection.png",
		    	"cellType" : "ro",
		    	"value" : {"default":fmd_i18n_el_datepickeropt},
		    	"displayOnly" : true,
		    	"afterProperty" : "id"
		    },
		    "databinding" : {
		    	"name" : fmd_i18n_prop_binding,
		    	"img" : "databinding.png",
		    	"cellType" : {
					"type" : "coro",
					"options":"fmdmeta_prop.model_binding_list" //initialized later, so use a reference here, call eval when use
			    },
			    "value" : {"default":""},
		    	"validator" : "NotEmpty"
		    },
		    "validation-value" : {
		    	"name" : fmd_i18n_prop_valuevalidation,
		    	"img" : "validation.png",
			    "cellType" : "ace_validation",
			    "arguments" : {
					"v" : fmd_i18n_modules.datepickeropt.value
				},
				"params" : {
					"require" : "databinding",
					"inputindex" : 0	//input index for validation in this component, starts from 0
				},
			    "value" : {"default":""}
		    },
		    "dateformat" : {
		    	"name" : fmd_i18n_modules.datepickeropt.dateformat,
		    	"cellType" : {"type":"coro",
			    	"options":[//["",""],
			    	           //["date",fmd_i18n_modules.datepickeropt.format_date],
						         ["datetimemm",fmd_i18n_modules.datepickeropt.format_datetimemm]
//						         ["datetimess",fmd_i18n_modules.datepickeropt.format_datetimess],
//						         ["time",fmd_i18n_modules.datepickeropt.format_time]
							  	]
				},
		    	"value" : {"default":"datetimemm"},
		    	"tooltip" : fmd_i18n_modules.datepickeropt.format_date
		    }
		},
		"includes-events" : {
			"common" : fmdmeta_prop.common.all.events,
			"controlcommon" : fmdmeta_prop.common.datacontrol.events
		},
		"events" : {
			
		},
		"onApply" : function() {
			var obj = designer.getSelected();
			var vals = fmdc.version.formdata.propconf[obj.attr("id")];
			//alert('input onApply fmdc.version.formdata.propconf[$obj.attr("id")]=\n'+JSON.stringify(vals));
			if (vals["labelPosition"]=='left') {
				obj.html('<span style="width:100%;display:inline;"><label style="width:40%;float:left;" class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label><input style="width:60%" class="large" type="text" name="input" value="&nbsp;&nbsp;&nbsp;&nbsp;2015-01-01" readonly="readonly" style="background-image:url('+resloc+'/static/images/form/designer/prop/datepicker.png);background-repeat:no-repeat"/></span>');
			} else if (vals["labelPosition"]=='right') {
				obj.html('<span style="width:100%;display:inline"><input style="width:60%" class="large" type="text" name="input" value="&nbsp;&nbsp;&nbsp;&nbsp;2015-01-01" readonly="readonly" style="background-image:url('+resloc+'/static/images/form/designer/prop/datepicker.png);background-repeat:no-repeat"/><label style="width:40%;float:right;" class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label></span>');
			} else if (vals["labelPosition"]=='bottom') {
				obj.html('<input class="large" type="text" name="input" value="&nbsp;&nbsp;&nbsp;&nbsp;2015-01-01" readonly="readonly" style="background-image:url('+resloc+'/static/images/form/designer/prop/datepicker.png);background-repeat:no-repeat"/><label class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label>');
			} else {//default is top
				obj.html('<label class="title">'+vals["i18nname-"+fmdmeta_prop.lang]+'</label><input class="large" type="text" name="input" value="&nbsp;&nbsp;&nbsp;&nbsp;2015-01-01" readonly="readonly" style="background-image:url('+resloc+'/static/images/form/designer/prop/datepicker.png);background-repeat:no-repeat"/>');
			}
			obj.find('label')//.html(vals["i18nname-"+fmdmeta_prop.lang])
				.css("display", (vals["hideLabel"]=='1')?"none":"block");
			obj.find('input').attr("disabled", vals["disabled"]=='1');
			// && obj.attr('maxlength', vals["maxlength"]).css("display", "inline-block");
		},
		"propDhxGridEvents" : {
			"onEditCell" : function(stage,rId,cId,nv,ov) {
				return true;
			},
			"onCellChanged" : function(rId,cId,nv) {
				if (nv && cId==fmdmeta_prop.gridconf.idx.value) {
					if (rId=='databinding') {
						var nvs = nv.split(".");
						if (nvs && nvs.length==2) {
							if (fmdc.models[nvs[0]] && fmdc.models[nvs[0]].attrs[nvs[1]]) {
								if (this.doesRowExist("i18nname-zh")) {
									var zh = this.cells("i18nname-zh", cId).getValue();
									if (!zh || zh==fmd_i18n_untitled) this.cells("i18nname-zh", cId).setValue(fmdc.models[nvs[0]].attrs[nvs[1]].desc_zh);
								}
								if (this.doesRowExist("i18nname-en")) {
									var en = this.cells("i18nname-en", cId).getValue();
									if (!en || en=='Untitled') this.cells("i18nname-en", cId).setValue(fmdc.models[nvs[0]].attrs[nvs[1]].desc_en);
								}
							} else {
								this.cells(rId,cId).setValue('');
								return;
							}
						}
						var ov = fmdc.version.formdata.propconf[designer.getSelected().attr("id")]["databinding"];
						if (ov==nv) {
							return;
						}
						if ("datetime"==fmdc.models[nvs[0]].attrs[nvs[1]].type) {
							fmdc.grid_prop.grid_bindCombo("dateformat", 
									fmdmeta_prop.gridconf.idx.value, 
									[["date",fmd_i18n_modules.datepickeropt.format_date],
							         ["datetimemm",fmd_i18n_modules.datepickeropt.format_datetimemm]
								  	], 
									{"comboSize":10, "comboWidth":160}, 
									"date");
						} else if ("string"==fmdc.models[nvs[0]].attrs[nvs[1]].type) {
							fmdc.grid_prop.grid_bindCombo("dateformat", 
									fmdmeta_prop.gridconf.idx.value, 
									[["time",fmd_i18n_modules.datepickeropt.format_time]
								  	], 
									{"comboSize":10, "comboWidth":160}, 
									"time");
						} else {
							msg(fmd_i18n_modules.datepickeropt.msg_plsseldateorstr);
							delete fmdc.version.formdata.propconf[designer.getSelected().attr("id")]["databinding"];
							delete fmdc.version.formdata.propconf[designer.getSelected().attr("id")]["dateformat"];
							return;
						}
					}
				}
			}
		}
	};
